package com.sxj.corejava.code07_面向对象.继承;

/**
 * @author 石小俊
 * @date 2024年03月19日 20:20
 */
public class MotorVehicle {

    private String no;  // 车牌号
    private String brand;   // 品牌

    public MotorVehicle() {
    }

    public MotorVehicle(String no, String brand) {
        this.no = no;
        this.brand = brand;
    }

    public void show() {
        System.out.println("这是一辆机动车");
    }

    public String getNo() {
        return no;
    }

    public void setNo(String no) {
        this.no = no;
    }

    public String getBrand() {
        return brand;
    }

    public void setBrand(String brand) {
        this.brand = brand;
    }
}

class Car extends MotorVehicle {
    private String type;    // 型号

    @Override
    public void show() {
        System.out.println("这是一辆小轿车");

    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }
}

class Test {
    public static void main(String[] args) {
        Car car = new Car();
        car.show();
    }
}
